package com.xgkj.diyiketang.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.xgkj.diyiketang.EatShowApp;
import com.xgkj.diyiketang.R;
import com.xgkj.diyiketang.util.ToastUtil;
import com.xgkj.diyiketang.weidget.ClearableEditText;
import com.xgkj.diyiketang.weidget.MoneyInputEditText;

public class ZhiboSetActivity extends BaseActivity implements View.OnClickListener {
    private ImageView fengmian, fengmian_gone, title_img, neirong_img, pression,guanbi;
    private EditText neirong_et, password, starttime_et;
    private Button live_prepare_btn, yuyue_btn, free_btn, money_btn, secrit_btn;
    private LinearLayout money_num_ll, pwd_ll;
    private MoneyInputEditText chare_et;
    private RelativeLayout starttime_rl, leibie_layout,zhibo_setting_ll;
    private ClearableEditText pwd_et;
    private TextView set_address;
    private EditText yuyuestartTime;
    private TextView liveCateText;
    private String type;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_zhibo_set);
        initUI();
        initData();
    }

    private void initData() {
////        if (null == imageId) {
//            ToastUtil.showMessage(this,"请上传直播封面");
//        }
//        if (null == neirong_et.getText()) {
//            ToastUtil.showMessage(this,"请填写直播内容");
//        } else {
////            descString = neirong_et.getText().toString();
//        }
    }

    private void initUI() {
        type = getIntent().getExtras().getString("FROM");
        yuyue_btn = (Button) findViewById(R.id.yuyue_btn);
        set_address = (TextView) findViewById(R.id.fengmian_text);
        if (EatShowApp.getACache().getAsString("city")!=null){
            String city = EatShowApp.getACache().getAsString("city");
            set_address.setText(city);
        }
        fengmian = (ImageView) findViewById(R.id.fengmian_bg);
        fengmian_gone = (ImageView) findViewById(R.id.fengmian);
        guanbi = (ImageView) findViewById(R.id.close_btn);
        guanbi.setOnClickListener(this);
        title_img = (ImageView) findViewById(R.id.set_title_more);
        neirong_img = (ImageView) findViewById(R.id.title_more);
        pression = (ImageView) findViewById(R.id.upload_fengmian);
        neirong_et = (EditText) findViewById(R.id.hd_title);
        leibie_layout = (RelativeLayout) findViewById(R.id.leibie_layout);
        zhibo_setting_ll = (RelativeLayout) findViewById(R.id.zhibo_setting_ll);
//        starttime_et = (EditText) findViewById(R.id.starttime_content);
        live_prepare_btn = (Button) findViewById(R.id.live_prepare_btn);
        live_prepare_btn.setOnClickListener(this);
        free_btn = (Button) findViewById(R.id.zhibo_set_free);
        money_btn = (Button) findViewById(R.id.zhibo_set_money);
        secrit_btn = (Button) findViewById(R.id.zhibo_set_secrit);
        money_num_ll = (LinearLayout) findViewById(R.id.charge_layout);
        chare_et = (MoneyInputEditText) findViewById(R.id.charge_edit);
        pwd_ll = (LinearLayout) findViewById(R.id.pwd_layout);
        pwd_et = (ClearableEditText) findViewById(R.id.password_edit);
        yuyuestartTime = (EditText) findViewById(R.id.starttime_content);
        starttime_rl = (RelativeLayout) findViewById(R.id.starttime_layout);
        liveCateText = (TextView) findViewById(R.id.leibie_content);
        leibie_layout.setOnClickListener(this);
        yuyue_btn.setOnClickListener(this);
        starttime_rl.setOnClickListener(this);
        live_prepare_btn.setOnClickListener(this);
        free_btn.setOnClickListener(this);
        money_btn.setOnClickListener(this);
        secrit_btn.setOnClickListener(this);
        fengmian.setOnClickListener(this);
        title_img.setOnClickListener(this);
        neirong_img.setOnClickListener(this);
        pression.setOnClickListener(this);
        if (type.equals("ZHIBO")) {
            yuyue_btn.setVisibility(View.GONE);
            starttime_rl.setVisibility(View.GONE);
        } else if (type.equals("YUYUE")) {
            yuyue_btn.setVisibility(View.VISIBLE);
            starttime_rl.setVisibility(View.VISIBLE);
            live_prepare_btn.setVisibility(View.GONE);
        }
    }

    @Override
    public void onClick(View v) {

    }
}
